#!/bin/bash

getopt -Qn 'Error' hm:p: "$@"
if [ $# -eq 0 ];
then echo usage: query_profile_names -m [\"managed system\"] -p [\"partition name\"]
exit 0
fi

JAVAPATH="/opt/IBMJava2-131/jre/bin/"
x=`type -p java 2>/dev/null`
if [ "$x" != "" ]
then
  JAVAPATH=`/usr/bin/dirname $x`
fi
if [ $1 = '-h' ];
then echo
echo usage: query_profile_names -m [\"managed system\"] -p [\"partition name\"] 
echo '     ' list the partition profiles for the logical partition
echo
echo Options:
echo '   ' -m name of the managed system enclosed in double quotes \" \" 
echo '   ' -p name of the partition enclosed in double quotes \" \"
echo '   ' -h brings up this help screen
echo
exit 0
fi

if [ "${DEBUG_JARS_DIRECTORY}" != "" ] ; then
  if [ -d ${DEBUG_JARS_DIRECTORY} ] ; then
    for i in ${DEBUG_JARS_DIRECTORY}/*.jar
    do
       debug_jars=${debug_jars}:$i
    done
  fi
fi

export CLASSPATH=${DEBUG_JARS_DIRECTORY}:${debug_jars}:/usr/websm/codebase/pluginjars/hsc.jar:/usr/websm/codebase/pluginjars/sniacimom.jar:/usr/websm/codebase/pluginjars/xerces.jar:/usr/websm/codebase/pluginjars/HwmcaCommon.jar:/usr/websm/codebase/pluginjars/auifw.jar:$CLASSPATH
export PATH=$JAVAPATH:$PATH

if [ $1 = '-m' -a $3 = '-p' ];
then java -Djavax.net.ssl.keyStore=/usr/websm/codebase/SM.pubkr -Djavax.net.ssl.keyStorePassword=defp -Dorg.snia.wbem.cimom.properties=/opt/hsc/data/cim.properties com.ibm.hsc.common.util.QueryProfileNames "\"$2\"" "\"$4\""
exit 0
fi
echo usage: query_profile_names -m [\"managed system\"] -p [\"partition name\"] 
exit 1
